<?php 
include ("../../checkuser.php"); 
include "../../conf.php";
?>
<style>
a:link {text-decoration: none; color:#123456}
a:visited {text-decoration: none; color:#123456}
a:hover {text-decoration: none; color:#333333}
a:active {text-decoration: none; color:#123456}
</style>

<?php
$ueber = isset($_GET['ueber']) ? $_GET['ueber'] : "";
$template = isset($_GET['template']) ? $_GET['template'] : "";


$bid=$_SESSION["user_id"];
// Theme auslesen
$result = mysql_query("SELECT * FROM benutzerdaten where Id=$bid",$connect);
while($benutzer=mysql_fetch_array($result))
{
$theme=$benutzer['theme'];
}
// Aufbau Kopf unf Menu im aktiviertem Theme
include "../../themes/$theme/include/kopf.php";
echo "<a href='../../intern.php'>Zur Startseite</a><br>";
?>
<td>
<?php
// &Uuml;berschrift anlegen
if (isset($_POST['submitueber']))
{
$sql="INSERT INTO menugenerator (inhalt, reihe) 
VALUES ('".$_POST['inhalt']."','".$_POST['reihe']."')";
$result = mysql_query($sql,$connect);
echo "-> &Uuml;berschrift angelegt<br>";
// ENDE &Uuml;berschrift anlegen
}

// Template anlegen
if (isset($_POST['submittemplate']))
{

$sql="INSERT INTO menugenerator (inhalt, reihe, template) 
VALUES ('".$_POST['inhalt']."','".$_POST['reihe']."','1')";
$result = mysql_query($sql,$connect);
echo "-> Template angelegt<br>";
// ENDE Template anlegen
}
//&Uuml;berschrift anlegen
if ($ueber==1)
{
?>
 <table style="font-family: Verdana,Arial,sans-serif;    
    font-style:       normal;
    font-size:        11px;
    BORDER-TOP:       #A6A6A6 1px solid; 
    BORDER-LEFT:      #A6A6A6 1px solid; 
    BORDER-BOTTOM:    #A6A6A6 1px solid;
    BORDER-RIGHT:     #A6A6A6 1px solid;">
 <form method="post" name="meins" action="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>">
<tr>
<b>&Uuml;berschrift anlegen</b></td>
</tr>
    <tr>
      <td>Inhalt:<input name="inhalt" type="text" size="60" maxlength="120">
      Reihenfolge: <input name="reihe" type="text" size="5" maxlength="5">

<input name="submitueber" class="Button" type="submit" value=" Absenden ">
</form>

</td>
    </tr>
    </table>
    <?php
}
//Template anlegen
if ($template==1)
{
?>
 <table style="font-family: Verdana,Arial,sans-serif;    
    font-style:       normal;
    font-size:        11px;
    BORDER-TOP:       #A6A6A6 1px solid; 
    BORDER-LEFT:      #A6A6A6 1px solid; 
    BORDER-BOTTOM:    #A6A6A6 1px solid;
    BORDER-RIGHT:     #A6A6A6 1px solid;">
 <form method="post" name="meins" action="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>">
<tr>
<b>Template anlegen</b></td>
</tr>
    <tr>
      <td>
      <select name="inhalt" size="1"> 
<option value=xxx>Template ausw&auml;hlen</option>
<?php     
$do = opendir('../../menutemplates'); 
$f = array(); 

while (false !== ($file = readdir($do)))

{ if (!preg_match('/^.{1,2}$/',$file)) 
{ $f[] = $file; } } 

closedir($do); 
arsort($f); 
foreach($f as $file)
{


echo "<option value=$file>$file</option>";
//echo '</b><a href="'.$HTTP_SERVER_VARS['PHP_SELF'].'?del='.$file.'"><img src="bilder/3.gif" border="0"></td></tr>';

     
}?>
</select>      
      
      Reihenfolge: <input name="reihe" type="text" size="5" maxlength="5">

<input name="submittemplate" class="Button" type="submit" value=" Absenden ">
</form>

</td>
    </tr>
    </table>
    <?php
}
?>
<b>Menugenerator:</b><br><br>
Menupunkt anlegen:
[<a title="&Uuml;berschrift anlegen" href="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>?ueber=1">&Uuml;berschrift</a>]
[<a title="&Uuml;berschrift anlegen" href="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>?template=1">Template</a>]

 <table style="font-family: Verdana,Arial,sans-serif;    
    font-style:       normal;
    font-size:        11px;
    BORDER-TOP:       #A6A6A6 1px solid; 
    BORDER-LEFT:      #A6A6A6 1px solid; 
    BORDER-BOTTOM:    #A6A6A6 1px solid;
    BORDER-RIGHT:     #A6A6A6 1px solid;">
<tr>
<td>Aktionen</td><td>Name/Template</td><td>Reihenfolge</td>
<tr>

<?php
// Ausgabe des Menus
$result = mysql_query("SELECT * FROM menugenerator ORDER BY reihe ASC",$connect);
while($table=mysql_fetch_array($result))
{
?>
<tr><td></td><td><?php if ($table['template']==1) { echo "<b>[T] </b>"; }echo $table['inhalt']; ?></td><td><?php echo $table['reihe']; ?></td>
<?php  
}
?>  
</table>
</td>

